<template>
    <div class="module">
        <p v-if="singleChoiceList != null && singleChoiceList.length >=1" class="subject-type">选择题</p>
        <single-choice-subject v-for="(element,index) in singleChoiceList"
                               :key="index"
                               :subject="element"
                               :options="options"
                               :code="index"
                               :answers="answers"
                               :isUse="isUse"
        >
        
        </single-choice-subject>
    </div>
</template>

<script>
import SingleChoiceSubject from "@c/SingleChoiceSubject";

export default {
    name: "SingleChoiceModule",
    components: { SingleChoiceSubject },
    created() {
        // window.addEventListener("storage", this.initComponent,false);
        for (let i = 0; i < this.singleChoiceList.length; i++) {
            // console.log("查看传输到题目的内容::", this.singleChoiceList[i]);
            // 解析
            let temp = this.singleChoiceList[i].options;
            this.options.push(temp);
            this.answers.push(this.singleChoiceList[i].answer);
        }
    },
    beforeDestroy() {
        // window.removeEventListener("storage", this.initComponent,false);
    },
    props: {
        singleChoiceList: Array,
        isUse:Boolean
        
    },
    data() {
        return {
            options: [],
            answers: []
        };
    },
    methods: {}
};
</script>

<style scoped lang="scss">

</style>